package com.itheima.mapper;

import com.github.pagehelper.Page;
import com.itheima.pojo.Setmeal;
import com.itheima.pojo.SetmealVO;
import org.apache.ibatis.annotations.*;

import java.util.ArrayList;
import java.util.List;

@Mapper
public interface SetmealMapper {
@Select("select*from health_chuanzhi.t_setmeal where id=#{id}")
    Setmeal findById(int id);
@Delete("delete from health_chuanzhi.t_setmeal where id=#{id}")
    void deleteById(Integer id);
    @Options(useGeneratedKeys = true , keyProperty = "id")
@Insert("insert into health_chuanzhi.t_setmeal  (name,code,helpCode,sex,age,price,remark,attention,img)"
        +"values (#{name},#{code},#{helpCode},#{sex},#{age},#{price},#{remark},#{attention},#{img})")
    void addSetmeal(Setmeal setmeal);

    @Select("select*from health_chuanzhi.t_setmeal where name=#{name} and code=#{code}")
    Setmeal getSetmeal(Setmeal setmeal);


    @Insert("insert into health_chuanzhi.t_setmeal_checkgroup(setmeal_id, checkgroup_id) "+
    "values (#{id},#{id1})")
    void addGroup(Integer id, Long id1);

    Page<Setmeal> findPage(String queryString);

    void update(Setmeal setmeal);

@Select("SELECT *from health_chuanzhi.t_setmeal")
    List<Setmeal> getAll();

    List<SetmealVO> getSetmealNameAndCount(Integer top);
}
